{#
Copyright (c) 2020 Andy Zhou
MIT License
#}
{% extends 'base.html' %}
{% from 'macros.html' import post_actions with context %}
{% from 'bootstrap/form.html' import render_form %}
{% from 'bootstrap/pagination.html' import render_pagination %}
{% block title %} Post - {{ post.title }} {% endblock %}
{% block page_content %}
    <div class="row">
        <div class="col-lg-8" style="font-size: large">
            <div class="page-header">
                <h1>
                    {{ post.title }}
                </h1>
                <small>
                    {{ _("Date:") }} {{ moment(post.timestamp).format('LL') }}<br>
                    {{ _("Author:") }}
                    {% if post.author %}
                        <a href="{{ post.author.profile_url() }}" class="profile-popover"
                           data-href="{{ url_for('ajax.get_profile', user_id=post.author.id) }}">
                            {{ post.author.username }}
                        </a>
                    {% else %}
                        {{ _("Deleted Flog User") }}
                    {% endif %}
                </small>
            </div>
            <br>
            <div id="post-content">
                {{ post.content | safe }}
            </div>
            {% if post.columns %}
                <p class="small">
                    {{ _("This post belongs to") }}
                    {% for column in post.columns[:-1] %}
                        <a href="{{ url_for('main.view_column', id=column.id) }}">
                            {{ _("Column") }} 「{{ column.name }}」
                        </a>,
                    {% endfor %}
                    {% if post.columns | length > 1%} {{ _("and") }}{% endif %}
                    <a href="{{ url_for('main.view_column', id=post.columns[-1].id) }}">
                        {{ _("Column") }} 「{{ post.columns[-1].name }}」
                    </a>.
                </p>
            {% endif %}
            {{ post_actions(post, show_collectors=True) }}
            <div class="comments" id="comments">
                {% include 'main/_comments.html' %}
            </div>
        </div>
        {% include 'main/_sidebar.html' %}
    </div>
    {{ ckeditor.load() }}
    {{ ckeditor.config(custom_config="width: 'auto'; height: 30;") }}
{% endblock page_content %}
